//
//  FamilyListViewController.m
//  OST
//
//  Created by mac on 13-7-18.
//  Copyright (c) 2013年 mac. All rights reserved.
//

#import "FamilyListViewController.h"
#import "FamilyData.h"
#import "GpsHistoryViewController.h"

#import "MapViewController.h"

@interface FamilyListViewController ()

@end

@implementation FamilyListViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    closeNextPage = YES;
    threadLoadData = NO;
    
    [self addBottomView];
    dataTableView.frame = CGRectMake(0, 0, 320, self.view.frame.size.height - 60);
    self.title =@"Gps";
    
    [self refreshData];
}


-(CGFloat)rowHeight
{
    return 76;
}

- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
	NSUInteger row=[indexPath row];
    static NSString *FamilyCellIdentifier = @"FamilyCellIdentifier";
    FamilyCell *cell = (FamilyCell*)[dataTableView dequeueReusableCellWithIdentifier:FamilyCellIdentifier];
    if (cell==nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"FamilyCell" owner:self options:nil]lastObject];
        [cell initView];
        cell.delegate = self;
    }
    NSDictionary *rowData = [self.rows objectAtIndex:row];
    cell.data = rowData;
    return cell;
}

-(void)didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

-(void)openCurrentPositon:(NSDictionary *)data
{
    MapViewController *map = [[MapViewController alloc]init];
    map.type = 2;
    map.mid = [data objectForKey:@"id"];
    [self.navigationController pushViewController:map animated:YES];
}

-(void)openHistoryPositon:(NSDictionary *)data
{
    GpsHistoryViewController *history = [[GpsHistoryViewController alloc]init];
    history.data = data;
    [self.navigationController pushViewController:history animated:YES];
}


-(NSArray *)loadPageData:(int)page
{
    [activity startAnimating];
    [[FamilyData sharedInstance]getDataWithDataRecivedBlock:^(id data) {
        [activity stopAnimating];
        [super doneLoadingTableViewData:data];
    }];
    
    
    return nil;
}

@end
